package it.eng.area118.mdocommon;

/**
 * 
 * @author Luigi Bifulco Command interface, expose execute method in synch and
 *         asynch mode
 * @param <Params>
 *            Command Parameters
 * @param <Result>
 *            Result of command execution
 */

public interface Command<Params, Result> {

	/**
	 * Method for executing the command in synch mode
	 * 
	 * @param params
	 * @return null if timeout
	 */
	public Result execute(Params... params) throws RuntimeException;

	/**
	 * Method for executing the command in async mode, needs to extends a
	 * {@link Callback} for result control.
	 * 
	 * @param callback
	 *            the callback invoked on any result
	 * @param params
	 *            the paramters needed to the execution of Command
	 */
	public void execute(Callback<Result> callback, Params... params) throws RuntimeException;

}
